package com.zshan.clinic.mini.constant;

import com.zshan.clinic.common.util.string.StringUtil;

public class MiniConstant {

    public static final String request_prefix = "/mini";

    //过滤器白名单
    public static final String [] filter_allow = {request_prefix + "/login",request_prefix + "/file"};

    //拦截器白名单
    public static final String [] interceptor_allow = {request_prefix + "/login",request_prefix + "/file"};


    public static boolean isInterceptorAllow(String requestUri) {
        //1.定义一个标记
        boolean flag = false;
        //2.遍历允许访问的路径
        for (String path : MiniConstant.interceptor_allow){
            if (StringUtil.isNotBlank(path) && requestUri.startsWith(path)){
                flag = true;
                break;
            }
        }
        return flag;
    }

    public static boolean isFilterAllow(String requestUri) {
        //1.定义一个标记
        boolean flag = false;
        //2.遍历允许访问的路径
        for (String path : MiniConstant.filter_allow){
            if (StringUtil.isNotBlank(path) && requestUri.startsWith(path)){
                flag = true;
                break;
            }
        }
        return flag;
    }
}
